//Set working directory and import data file
cd "/Users/gabriellelevy/OneDrive - Dartmouth College/Replication Files/Nielsen et al."
clear
import excel using levy_nielsen_reduced.xlsx, firstrow // reduced data set takes less time to load (only has variables that are needed for purposes of replicating main model)

//REPLICATING NIELSEN ET AL. RESULTS 

  * Main Model: aid shocks with full covariate set
***************************************************
relogit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3, cl(countrynum)
//This code replicates Nielsen's results perfectly.


//ADDING NEW VARIABLES
//converting added variables from strings to numbers
destring epr_exclpop, replace
destring epr_discrimpop, replace
destring epr_nstar, replace
destring hief_ef, replace
destring v2x_corr, replace
destring capacity, replace

sum epr_exclpop epr_discrimpop epr_nstar hief_ef v2x_corr capacity


//NSTAR SUBSET ANALYSIS (data for Table 5)
sum epr_nstar, d
kdensity epr_nstar

cumul epr_nstar, gen(nstar_pctl) equal

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if nstar_pctl<.4 & nstar_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if nstar_pctl>.4 & nstar_pctl!=., cl(countrynum)

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if nstar_pctl<.5 & nstar_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if nstar_pctl>.5 & nstar_pctl!=., cl(countrynum)

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if nstar_pctl<.6 & nstar_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if nstar_pctl>.6 & nstar_pctl!=., cl(countrynum)

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if nstar_pctl<.7 & nstar_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if nstar_pctl>.7 & nstar_pctl!=., cl(countrynum)

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if nstar_pctl<.8 & nstar_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if nstar_pctl>.8 & nstar_pctl!=., cl(countrynum)

//SUBSET ANALYSES FOR ADDITIONAL ETHNIC DIVIDES VARIABLES (exclpop, discrimpop, hief)
//exclpop (data for Table B5)
sum epr_exclpop, d
kdensity epr_exclpop

cumul epr_exclpop, gen(exclpop_pctl) equal

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if exclpop_pctl<.4 & exclpop_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if exclpop_pctl>.4 & exclpop_pctl!=., cl(countrynum)

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if exclpop_pctl<.5 & exclpop_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if exclpop_pctl>.5 & exclpop_pctl!=., cl(countrynum)

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if exclpop_pctl<.6 & exclpop_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if exclpop_pctl>.6 & exclpop_pctl!=., cl(countrynum)

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if exclpop_pctl<.7 & exclpop_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if exclpop_pctl>.7 & exclpop_pctl!=., cl(countrynum)

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if exclpop_pctl<.8 & exclpop_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if exclpop_pctl>.8 & exclpop_pctl!=., cl(countrynum)

//discrimpop (data for Table B8)
sum epr_discrimpop, d
kdensity epr_discrimpop

cumul epr_discrimpop, gen(discrimpop_pctl) equal

//logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if discrimpop_pctl<.4 & discrimpop_pctl!=., cl(countrynum) //insufficient data

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if discrimpop_pctl>.4 & discrimpop_pctl!=., cl(countrynum)

//logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if discrimpop_pctl<.5 & discrimpop_pctl!=., cl(countrynum) //insufficient data

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if discrimpop_pctl>.5 & discrimpop_pctl!=., cl(countrynum)

//logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if discrimpop_pctl<.6 & discrimpop_pctl!=., cl(countrynum) //insufficient data

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if discrimpop_pctl>.6 & discrimpop_pctl!=., cl(countrynum)

//logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if discrimpop_pctl<.7 & discrimpop_pctl!=., cl(countrynum) //insufficient data

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if discrimpop_pctl>.7 & discrimpop_pctl!=., cl(countrynum)

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if discrimpop_pctl<.8 & discrimpop_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if discrimpop_pctl>.8 & discrimpop_pctl!=., cl(countrynum)

//hief (data for Table B11)
sum hief_ef, d
kdensity hief_ef

cumul hief_ef, gen(hief_pctl) equal

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if hief_pctl<.4 & hief_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if hief_pctl>.4 & hief_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if hief_pctl<.5 & hief_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if hief_pctl>.5 & hief_pctl!=., cl(countrynum)

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if hief_pctl<.6 & hief_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if hief_pctl>.6 & hief_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if hief_pctl<.7 & hief_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if hief_pctl>.7 & hief_pctl!=., cl(countrynum)  

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if hief_pctl<.8 & hief_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if hief_pctl>.8 & hief_pctl!=., cl(countrynum) 



//CORRUPTION SUBSET ANALYSIS (data for Table 6)
cumul v2x_corr, gen(corr_pctl) equal

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if corr_pctl<.4 & corr_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if corr_pctl>.4 & corr_pctl!=., cl(countrynum)

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if corr_pctl<.5 & corr_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if corr_pctl>.5 & corr_pctl!=., cl(countrynum)

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if corr_pctl<.6 & corr_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if corr_pctl>.6 & corr_pctl!=., cl(countrynum)

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if corr_pctl<.7 & corr_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if corr_pctl>.7 & corr_pctl!=., cl(countrynum)

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if corr_pctl<.8 & corr_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if corr_pctl>.8 & corr_pctl!=., cl(countrynum)


//STATE CAPACITY SUBSET ANALYSIS (data for Table 7)
cumul capacity, gen(capacity_pctl) equal

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if capacity_pctl<.4 & capacity_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if capacity_pctl>.4 & capacity_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if capacity_pctl<.5 & capacity_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if capacity_pctl>.5 & capacity_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if capacity_pctl<.6 & capacity_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if capacity_pctl>.6 & capacity_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if capacity_pctl<.7 & capacity_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if capacity_pctl>.7 & capacity_pctl!=., cl(countrynum) 

logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if capacity_pctl<.8 & capacity_pctl!=., cl(countrynum) 

//logit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 if capacity_pctl>.8 & capacity_pctl!=., cl(countrynum) //insufficient data


//INTERACTION ANALYSES
//Table A4: Nielsen et al. – Ethnic Divides Interaction Analysis
//original
relogit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3, cl(countrynum) 
outreg2 using tableA4.doc, replace ctitle(Original)
//nstar
gen nstar_x_aid=epr_nstar*aidshock11
kdensity nstar_x_aid
logit prio  aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 nstar_x_aid epr_nstar, cl(countrynum) 
outreg2 using tableA4.doc, append ctitle(Nstar)

//Table B2: Nielsen et al. – Ethnic Divides Interaction Analysis (full)
//original
relogit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3, cl(countrynum) 
outreg2 using tableB2.doc, replace ctitle(Original)
//nstar
logit prio  aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 nstar_x_aid epr_nstar, cl(countrynum) 
outreg2 using tableB2.doc, append ctitle(Nstar)
//other variables
//exclpop
gen exclpop_x_aid=epr_exclpop*aidshock11
kdensity exclpop_x_aid
logit prio  aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 exclpop_x_aid epr_exclpop, cl(countrynum) 
outreg2 using tableB2.doc, append ctitle(Exclpop)
//discrimpop
gen discrimpop_x_aid=epr_discrimpop*aidshock11
kdensity discrimpop_x_aid
logit prio  aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 discrimpop_x_aid epr_discrimpop, cl(countrynum)
outreg2 using tableB2.doc, append ctitle(Discrimpop) 
//hief
gen hief_x_aid=hief_ef*aidshock11
kdensity hief_x_aid
logit prio  aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 hief_x_aid hief_ef aidshock11, cl(countrynum) 
outreg2 using tableB2.doc, append ctitle(Hief)


//Table A5: Nielsen et al. – Corruption Interaction Analysis 
//original
relogit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3, cl(countrynum) 
outreg2 using tableA5.doc, replace ctitle(Original)
//v2x_corr
gen corr_x_aid=v2x_corr*aidshock11
kdensity corr_x_aid
logit prio  aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 corr_x_aid v2x_corr aidshock11, cl(countrynum) 
outreg2 using tableA5.doc, append ctitle(v2x_corr)

//Table A6: Nielsen et al. – State Capacity Interaction Analysis
//original
relogit prio aidshock11 aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3, cl(countrynum) 
outreg2 using tableA6.doc, replace ctitle(Original)
//interaction
gen capacity_x_aid=capacity*aidshock11
kdensity capacity_x_aid
logit prio  aidshock11pos lPTSave_filled lassassinbanks lriotsbanks lstrikesbanks ldemonstrationsbanks linfantmort lnciv lpartautocracy lpartdemocracy lfactionaldemoc lfulldemocracy lln_rgdpc  lln_population  loil linstab ethfrac relfrac ncontig logmtn ColdWar _spline1 _spline2 _spline3 capacity_x_aid capacity aidshock11, cl(countrynum) 
outreg2 using tableA6.doc, append ctitle(capacity)


